<?php
require_once '../include/common.php';
ignore_user_abort();
set_time_limit(0); 
$file = "cache/gqq.db";
$hs_num = file_get_contents($file);
$hs= $hs_num + 1;
file_put_contents($file, $hs);



	$z_sql = "SELECT count(*) FROM `w_qq` WHERE gq='1' AND zt='1'";
	$z_sth = $db->query($z_sql);
	$z_num=$z_sth->fetch();
	$z_num = $z_num[0];
	$num=ceil($z_num / $run_num);
	

	$now_num=($hs_num%$num)*$run_num;
	
	$gqq_sql = "SELECT `qq`,`sid`,`t1`,`t2` FROM `w_qq` WHERE gq='1' AND zt='1' limit {$now_num},{$run_num}";
	$gqq_sth = $db->query($gqq_sql);
	$gqq=$gqq_sth->fetchAll();
	
	foreach ($gqq as $value) {
		$t1=$value[t1];
		$t2=$value[t2];
		$qq=$value[qq];
		$sid=$value[sid];
		$url = 'http://pt.3g.qq.com/s?aid=nLogin3gqqbysid&3gqqsid=' . $sid;
		$h = date("H");
		$f = date("i");
		$d = $h . $f;
		if ($t1 >= $t2) {
			$t2 = 2400 + $t2;
		}
		if ($t1 <= $d and $d <= $t2) {
			$result = cget($url);
		}
	}
echo 'ok';